import copy


def recognizer(code):
    outList = []

    import re
    #用正则表达式识别标识符
    pattern = r'\w+'   # - '\w'：匹配任意字母数字字符，包括下划线。
    for match in re.finditer(pattern, code):
        if not match.group() in outList:
            outList.append(match.group())
    return outList

code = "int var1; float var2;"
print(code)

ids = recognizer(code)
print(ids)
